package com.common.enums;

public enum Color {

    COLOR_BLUE("蓝色",1),
    COLOR_RED("红色",2),
    COLOR_GREEN("绿色",3),
    COLOR_YELLOW("黄色",4);

    public String getColor(Integer num){
        for (Color value : Color.values()) {
            if (value.getNum().equals(num)){
                return value.getName();
            }
        }
        return null;
    }


    Color(String name, Integer num) {
        this.name = name;
        this.num = num;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getNum() {
        return num;
    }

    public void setNum(Integer num) {
        this.num = num;
    }

    private String name;
    private Integer num;
}
